<!doctype html><html><head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>A canvas fontSize fillText example</title>

<script src="../canvas.vml.js"></script>
<script src="../canvas.js"></script>

<script>
function oncanvasready() {
    drawShape(document.getElementById('vmlcanvas'));
}
function matrix() {
    drawShape(document.getElementById('vmlcanvas'), 1);
}
function drawShape(canvas, matrix){
    if (!canvas.getContext){ return; }

    var ctx = canvas.getContext('2d');

    if (matrix) {
        ctx.clear();
        ctx.translate(-10, 5);
        ctx.scale(1.2, 0.8);
        ctx.rotate(5 * Math.PI / 180);
    }
    var w = 500, h = 800;
    var fillText = "AWawあ漢字!?@";
    ctx.fillStyle     = "blue";
    ctx.textBaseline  = "top";

    grid(ctx, w, h, 10, 5, "SkyBlue", "steelblue");

    var i = 0, v, dim, txt,
        ary = [6,7,8,9,10,11,12,14,16,18,20,24,28,32,36,40,48,58,64,72,84],
        iz = ary.length;
    for (; i < iz; ++i) {
        v = ary[i];
        txt = v + "pt;" + fillText;
        ctx.font = v + "pt Arial";
        ctx.fillText(txt, 10, i * 35 + 10);
    }
}
function grid(ctx, w, h, size, unit, color, color2) {
    var x, y, i, j;
    for (i = 0, x = size; x < w; ++i, x += size) {
        ctx.beginPath();
        ctx.strokeStyle = (i % unit) ? color : color2;
        ctx.moveTo(x, 0);
        ctx.lineTo(x, h);
        ctx.stroke();
        ctx.closePath();
    }
    for (j = 0, y = size; y < h; ++j, y += size) {
        ctx.beginPath();
        ctx.strokeStyle = (j % unit) ? color : color2;
        ctx.moveTo(0, y);
        ctx.lineTo(w, y);
        ctx.stroke();
        ctx.closePath();
    }
}
</script>
    <style type="text/css">
      body { margin: 20px; font-family: arial,verdana,helvetica; background: #fff;}
      h1 { font-size: 140%; font-weight:normal; color: #036; border-bottom: 1px solid #ccc; }
      canvas { border: 2px solid #000; float: left; margin-right: 1px; margin-bottom: 20px; }
      pre { float:left; display:block; background: rgb(238,238,238); border: 1px dashed #666; padding: 15px 20px; margin: 0 0 10px 0; }
    </style>
  </head>
  <body>
    <h1>A canvas <code>fontSize fillText</code> example</h1>
    <div>
      <input type="button" value="matrix effect" onclick="matrix()" />
      <br />
      <canvas id="vmlcanvas" class="vml" width="400" height="800"></canvas>
      <pre>
function oncanvasready() {
    drawShape(document.getElementById('vmlcanvas'));
}
function matrix() {
    drawShape(document.getElementById('vmlcanvas'), 1);
}
function drawShape(canvas, matrix){
    if (!canvas.getContext){ return; }

    var ctx = canvas.getContext('2d');

    if (matrix) {
        ctx.clear();
        ctx.translate(-10, 5);
        ctx.scale(1.2, 0.8);
        ctx.rotate(5 * Math.PI / 180);
    }
    var w = 500, h = 800;
    var fillText = "AWawあ漢字!?@";
    ctx.fillStyle     = "blue";
    ctx.textBaseline  = "top";

    grid(ctx, w, h, 10, 5, "SkyBlue", "steelblue");

    var i = 0, v, dim, txt,
        ary = [6,7,8,9,10,11,12,14,16,18,20,24,28,32,36,40,48,58,64,72,84],
        iz = ary.length;
    for (; i &lt; iz; ++i) {
        v = ary[i];
        txt = v + "pt;" + fillText;
        ctx.font = v + "pt Arial";
        ctx.fillText(txt, 10, i * 35 + 10);
    }
}
function grid(ctx, w, h, size, unit, color, color2) {
    var x, y, i, j;
    for (i = 0, x = size; x &lt; w; ++i, x += size) {
        ctx.beginPath();
        ctx.strokeStyle = (i % unit) ? color : color2;
        ctx.moveTo(x, 0);
        ctx.lineTo(x, h);
        ctx.stroke();
        ctx.closePath();
    }
    for (j = 0, y = size; y &lt; h; ++j, y += size) {
        ctx.beginPath();
        ctx.strokeStyle = (j % unit) ? color : color2;
        ctx.moveTo(0, y);
        ctx.lineTo(w, y);
        ctx.stroke();
        ctx.closePath();
    }
}
      </pre>
    </div>
  </body>
</html>
